package com.xian.cloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: xlr
 * @Date: Created in 下午9:10 2019/2/14
 */
@Slf4j
@RestController
public class AmqpController {

    @Autowired
    AmqpTemplate rabbitTemplate;

    @GetMapping("send")
    public String send(@RequestParam("message") String message){
        log.info( "message >>>>>>>>{}",message );
        rabbitTemplate.convertAndSend( "hello",message );
        return "success";
    }
}
